import {request} from "./index"

/** 获取购物券列表
 * 
 * @param {string} token
 * @param {number} page
 * @param {string} memberCouponStatus
 */
const getCoupon = (memberCouponStatus, page, token) => {
  return request.get(`v1/app/promotion/coupon/getCoupons`, {
    memberCouponStatus,
    page
  }, {
    "Authorization": token
  })
}

/** 获取可领取购物券列表
 * 
 * @param {string} token
 * @param {number} page
 */
const getPromotionCoupon = (page, token) => {
  return request.get(`v1/app/promotion/coupon`, {
    page,
    size: 100
  }, {
    "Authorization": token
  })
}

/** 领取购物券
 * 
 * @param {string} couponId
 * @param {string} token
 */
const drawCoupon = (couponId, token) => {
  return request.get(`v1/app/promotion/coupon/receive/${couponId}`, {}, {
    "Authorization": token
  })
}

/** 获取当前会员可使用的优惠券数量
 * 
 * @param {string} token
 */
const getCouponNum = (token) => {
  return request.get(`v1/app/promotion/coupon/getCouponsNum`, {}, {
    "Authorization": token
  })
}

export {
  getCoupon,
  getPromotionCoupon,
  drawCoupon,
  getCouponNum
}